package com.ailk.bi.cq.cqbiaudit.auditMap.control
{ 
	
	import com.ailk.bi.cq.cqbiaudit.auditMap.model.AuditMapModel;
	import com.ailk.bi.cq.cqbiaudit.common.Util;
	import com.ailk.bi.cq.cqbiaudit.vo.ResultVO;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	
	import mx.controls.Alert;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.remoting.RemoteObject;
	
	
	public class AuditMapControl extends EventDispatcher
	{
		[Bindable]
		private var auditMapiModel:AuditMapModel = AuditMapModel.getInstance();
		
		private var _service:RemoteObject; 
		
		public function AuditMapControl()
		{
			_service = new RemoteObject();
			_service.destination="auditMapService";
			_service.endpoint="messagebroker/amf";
			_service.addEventListener(FaultEvent.FAULT, Util.faultHandler);
			_service.getSampleData.addEventListener(ResultEvent.RESULT,getSampleDataResult );
			
		}
		
		//获取第三批kpi数据的dimVO
		public function getSampleData():void {
			_service.getSampleData();
		}
		
		private function getSampleDataResult(event:ResultEvent):void{	
			var result:ResultVO = _service.getSampleData.lastResult;
			auditMapiModel.sampleDataXML = new XML(result.xmlString);
		}
		
		
	}
}